package edu.guigu.appquickstart.simpleview.subitem;

import android.os.Bundle;
import android.widget.ImageView;

import androidx.appcompat.app.AppCompatActivity;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.bumptech.glide.request.RequestOptions;

import edu.guigu.appquickstart.R;

public class ImageActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_image);

        ImageView imageView = findViewById(R.id.image_avatar);
        Glide.with(this)
                .load("https://avatars.githubusercontent.com/u/1825798?v=4")
                .placeholder(R.drawable.ic_launcher_background)
                .error(R.drawable.ic_launcher_foreground)
                .centerCrop()
                //圆形图片
                // .apply(RequestOptions.circleCropTransform())
                // 圆角的半径
                .apply(RequestOptions.bitmapTransform(new RoundedCorners(60)))
                .into(imageView);
    }
}